<template>
    <div>
        <div class="w">
            <div class="gray-box">
                <div class="title">
                    <h2>热门商品</h2>
                </div>
                <div class="hot">
                    <div class="good-item" v-for="hotGood in hotGoodsList" :key="hotGood.id" >
                        <div class="good-img">
                            <a href="">
                                <img
                                    :src="hotGood.productImageBig"
                                    :alt="hotGood.productName"
                                />
                            </a>
                        </div>
                        <h6>{{hotGood.productName}}</h6>
                        <h3>{{hotGood.subTitle}}</h3>
                        <div class="good-price">
                            <div class="ds">
                                <button class="default-btn">查看详情</button>
                                <button class="main-btn">加入购物车</button>
                            </div>
                            <p><span>￥</span>1.00</p>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</template>

<script>
import { mapGetters } from 'vuex';
export default {
    name: "HotGoods",
    computed:{
        ...mapGetters('home',['hotGoodsList'])
    }
};
</script>

<style lang="less" scoped>
.w {
    width: 1220px;
    margin: 30px auto 0;
    .gray-box {
        position: relative;
        margin-bottom: 30px;
        overflow: hidden;
        background-color: #fff;
        border-radius: 8px;
        border: 1px solid #dcdcdc;
        border-color: rgba(0, 0, 0, 0.14);
        box-shadow: 0 3px 8px -6px rgba(0 0 0 / 10%);
        .title {
            display: flex;
            position: relative;
            z-index: 10;
            height: 60px;
            padding: 0 10px 0 24px;
            border-bottom: 1px solid #d4d4d4;
            border-radius: 8px 8px 0 0;
            background: linear-gradient(#fbfbfb, #ececec);
            line-height: 60px;
            font-size: 18px;
            color: #333;
            justify-content: space-between;
            align-items: center;
            h2 {
                font-size: 18px;
                font-weight: 400;
                color: #626262;
                display: inline-block;
            }
        }
        .hot {
            display: flex;
            .good-item {
                flex: 1;
                width: 25%;
                transition: all .5s;
                height: 430px;
                .good-img {
                    a {
                        font-style: normal;
                        text-decoration: none;
                        cursor: pointer;
                        transition: all 0.15s ease-out;
                        img {
                            margin: 50px auto 10px;
                            width: 206px;
                            height: 206px;
                            display: block;
                        }
                    }
                }
                h6{
                    line-height: 1.2;
                    font-size: 16px;
                    color: #424242;
                    margin: 0 auto;
                    padding: 0 14px;
                    text-align: center;
                    overflow: hidden;
                    font-weight: 400;
                }
                h3{
                    text-align: center;
                    line-height: 1.2;
                    font-size: 12px;
                    color: #d0d0d0;
                    padding: 10px;
                    font-weight: 400;
                }
                .good-price{
                    margin: 15px 0;
                    height: 30px;
                    text-align: center;
                    line-height: 30px;
                    color: #d44d44;
                    font-family: Arial;
                    font-size: 18px;
                    font-weight: 700;
                    .ds{
                        display: none;
                        justify-content: center;
                        .default-btn{
                            margin: 0 5px;
                            width: 100px;
                            height: 30px;
                            line-height: 28px;
                            vertical-align: middle;
                            border: 1px solid #e1e1e1;
                            border-radius: 4px;
                            font-size: 12px;
                            color: #646464;
                            background-color: #f9f9f9;
                            background-image: linear-gradient(180deg,#fff,#f9f9f9);
                            &:hover{
                                background-color: #eee;
                                background-image: linear-gradient(180deg,#f5f5f5,#eee);
                            }
                        }
                        .main-btn{
                            margin: 0 5px;
                            width: 100px;
                            height: 30px;
                            line-height: 28px;
                            vertical-align: middle;
                            border: 1px solid #5c81e3;
                            border-radius: 4px;
                            font-size: 12px;
                            color: #fff;
                            background-color: #678ee7;
                            background-image: linear-gradient(180deg,#678ee7,#5078df);
                            &:hover{
                                background-color: #6c8cd4;
                                background-image: linear-gradient(180deg,#6c8cd4,#4769c2);
                            }

                        }
                    }
                }
                &:hover{
                    transform: translateY(-3px);
                    box-shadow: 1px 1px 20px #999;
                    .good-price{
                        p{
                            display: none;
                        }
                        .ds{
                            display: flex;
                        }
                    }
                }
            }
        }
    }
}
</style>